public class test2 {
    //力扣 371 两数之和
    public static void main(String[] args) {
        System.out.println(getSum(13, 28));
    }

    public static int getSum(int a, int b) {
        while (b != 0) {
            //先算出a异或b，否则会改变a的值，影响b的运算结果
            int c = a ^ b;
            b = (a & b) << 1;
            a = c;
            System.out.println(a + " " + b);
        }
        return a;
    }
}
